<template>
  <div class="child1">
    <h1>我是Child1组件</h1>
    <h2>我有一个玩具：{{toy}}</h2>
    <button @click="handleClick">点我把玩具给我弟弟（Child2）玩玩</button>
  </div>
</template>

<script>
  export default {
    name:'Child1',
    data() {
      return {
        toy:'奥特曼'
      }
    },
    methods: {
      handleClick(){
        this.$bus.$emit('send-toy',this.toy)
      }
    },
  }
</script>

<style scoped>
  .child1 {
    background-color:orange;
    padding: 20px;
    box-shadow: 0 0 10px black;
    border-radius: 10px;
  }
</style>